#include <hxcpp.h>

#ifndef INCLUDED_haxe_Utf8
#include <haxe/Utf8.h>
#endif
namespace haxe{

Void Utf8_obj::__construct(Dynamic size)
{
{
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",9)
	this->__s = Array_obj< int >::__new();
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",10)
	if (((bool((size != null())) && bool((size > (int)0))))){
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",11)
		this->__s[(size - (int)1)] = (int)0;
	}
}
;
	return null();
}

Utf8_obj::~Utf8_obj() { }

Dynamic Utf8_obj::__CreateEmpty() { return  new Utf8_obj; }
hx::ObjectPtr< Utf8_obj > Utf8_obj::__new(Dynamic size)
{  hx::ObjectPtr< Utf8_obj > result = new Utf8_obj();
	result->__construct(size);
	return result;}

Dynamic Utf8_obj::__Create(hx::DynamicArray inArgs)
{  hx::ObjectPtr< Utf8_obj > result = new Utf8_obj();
	result->__construct(inArgs[0]);
	return result;}

Void Utf8_obj::addChar( int c){
{
		HX_SOURCE_PUSH("Utf8_obj::addChar")
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",14)
		this->__s->push(c);
	}
return null();
}


HX_DEFINE_DYNAMIC_FUNC1(Utf8_obj,addChar,(void))

::String Utf8_obj::toString( ){
	HX_SOURCE_PUSH("Utf8_obj::toString")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",18)
	return ::__hxcpp_char_array_to_utf8_string(this->__s);
}


HX_DEFINE_DYNAMIC_FUNC0(Utf8_obj,toString,return )

::String Utf8_obj::encode( ::String s){
	HX_SOURCE_PUSH("Utf8_obj::encode")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",24)
	return ::__hxcpp_char_bytes_to_utf8_string(s);
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(Utf8_obj,encode,return )

::String Utf8_obj::decode( ::String s){
	HX_SOURCE_PUSH("Utf8_obj::decode")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",30)
	return ::__hxcpp_utf8_string_to_char_bytes(s);
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(Utf8_obj,decode,return )

Void Utf8_obj::iter( ::String s,Dynamic chars){
{
		HX_SOURCE_PUSH("Utf8_obj::iter")
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",35)
		Array< int > array = ::__hxcpp_utf8_string_to_char_array(s);
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",36)
		{
			HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",36)
			int _g = (int)0;
			HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",36)
			while(((_g < array->length))){
				HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",36)
				int a = array->__get(_g);
				HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",36)
				++(_g);
				HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",37)
				chars(a).Cast< Void >();
			}
		}
	}
return null();
}


STATIC_HX_DEFINE_DYNAMIC_FUNC2(Utf8_obj,iter,(void))

int Utf8_obj::charCodeAt( ::String s,int index){
	HX_SOURCE_PUSH("Utf8_obj::charCodeAt")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",41)
	Array< int > array = ::__hxcpp_utf8_string_to_char_array(s);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",42)
	return array->__get(index);
}


STATIC_HX_DEFINE_DYNAMIC_FUNC2(Utf8_obj,charCodeAt,return )

bool Utf8_obj::validate( ::String s){
	HX_SOURCE_PUSH("Utf8_obj::validate")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",46)
	try{
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",47)
		::__hxcpp_utf8_string_to_char_array(s);
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",48)
		return true;
	}
	catch(Dynamic __e){
		{
			Dynamic e = __e;{
			}
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",50)
	return false;
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(Utf8_obj,validate,return )

int Utf8_obj::length( ::String s){
	HX_SOURCE_PUSH("Utf8_obj::length")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",54)
	Array< int > array = ::__hxcpp_utf8_string_to_char_array(s);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",55)
	return array->length;
}


STATIC_HX_DEFINE_DYNAMIC_FUNC1(Utf8_obj,length,return )

int Utf8_obj::compare( ::String a,::String b){
	HX_SOURCE_PUSH("Utf8_obj::compare")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",59)
	Array< int > a_ = ::__hxcpp_utf8_string_to_char_array(a);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",60)
	Array< int > b_ = ::__hxcpp_utf8_string_to_char_array(b);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",61)
	int min = (  (((a_->length < b_->length))) ? int(a_->length) : int(b_->length) );
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",62)
	{
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",62)
		int _g = (int)0;
		HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",62)
		while(((_g < min))){
			HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",62)
			int i = (_g)++;
			HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",64)
			if (((a_->__get(i) < b_->__get(i)))){
				HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",64)
				return (int)-1;
			}
			HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",65)
			if (((a_->__get(i) > b_->__get(i)))){
				HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",65)
				return (int)1;
			}
		}
	}
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",67)
	return (  (((a_->length == b_->length))) ? int((int)0) : int((  (((a_->length < b_->length))) ? int((int)-1) : int((int)1) )) );
}


STATIC_HX_DEFINE_DYNAMIC_FUNC2(Utf8_obj,compare,return )

::String Utf8_obj::sub( ::String s,int pos,int len){
	HX_SOURCE_PUSH("Utf8_obj::sub")
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",71)
	Array< int > array = ::__hxcpp_utf8_string_to_char_array(s);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",72)
	Array< int > sub = array->slice(pos,len);
	HX_SOURCE_POS("/usr/lib/haxe/std/cpp/_std/haxe/Utf8.hx",73)
	return ::__hxcpp_char_array_to_utf8_string(sub);
}


STATIC_HX_DEFINE_DYNAMIC_FUNC3(Utf8_obj,sub,return )


Utf8_obj::Utf8_obj()
{
}

void Utf8_obj::__Mark(HX_MARK_PARAMS)
{
	HX_MARK_BEGIN_CLASS(Utf8);
	HX_MARK_MEMBER_NAME(__s,"__s");
	HX_MARK_END_CLASS();
}

Dynamic Utf8_obj::__Field(const ::String &inName,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"sub") ) { return sub_dyn(); }
		if (HX_FIELD_EQ(inName,"__s") ) { return __s; }
		break;
	case 4:
		if (HX_FIELD_EQ(inName,"iter") ) { return iter_dyn(); }
		break;
	case 6:
		if (HX_FIELD_EQ(inName,"encode") ) { return encode_dyn(); }
		if (HX_FIELD_EQ(inName,"decode") ) { return decode_dyn(); }
		if (HX_FIELD_EQ(inName,"length") ) { return length_dyn(); }
		break;
	case 7:
		if (HX_FIELD_EQ(inName,"compare") ) { return compare_dyn(); }
		if (HX_FIELD_EQ(inName,"addChar") ) { return addChar_dyn(); }
		break;
	case 8:
		if (HX_FIELD_EQ(inName,"validate") ) { return validate_dyn(); }
		if (HX_FIELD_EQ(inName,"toString") ) { return toString_dyn(); }
		break;
	case 10:
		if (HX_FIELD_EQ(inName,"charCodeAt") ) { return charCodeAt_dyn(); }
	}
	return super::__Field(inName,inCallProp);
}

Dynamic Utf8_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
	switch(inName.length) {
	case 3:
		if (HX_FIELD_EQ(inName,"__s") ) { __s=inValue.Cast< Array< int > >(); return inValue; }
	}
	return super::__SetField(inName,inValue,inCallProp);
}

void Utf8_obj::__GetFields(Array< ::String> &outFields)
{
	outFields->push(HX_CSTRING("__s"));
	super::__GetFields(outFields);
};

static ::String sStaticFields[] = {
	HX_CSTRING("encode"),
	HX_CSTRING("decode"),
	HX_CSTRING("iter"),
	HX_CSTRING("charCodeAt"),
	HX_CSTRING("validate"),
	HX_CSTRING("length"),
	HX_CSTRING("compare"),
	HX_CSTRING("sub"),
	String(null()) };

static ::String sMemberFields[] = {
	HX_CSTRING("__s"),
	HX_CSTRING("addChar"),
	HX_CSTRING("toString"),
	String(null()) };

static void sMarkStatics(HX_MARK_PARAMS) {
};

Class Utf8_obj::__mClass;

void Utf8_obj::__register()
{
	Static(__mClass) = hx::RegisterClass(HX_CSTRING("haxe.Utf8"), hx::TCanCast< Utf8_obj> ,sStaticFields,sMemberFields,
	&__CreateEmpty, &__Create,
	&super::__SGetClass(), 0, sMarkStatics);
}

void Utf8_obj::__boot()
{
}

} // end namespace haxe
